#include <iostream>
#include <sstream>
#include <string>
#include <map>
#include <vector>
#include <boost/algorithm/string.hpp>

#include <boost/thread/xtime.hpp>
#include <boost/thread/thread.hpp>

#include "base/logging.h"
#include "sns/xiaonei_adapter.h"

using namespace std;
using namespace sns::xiaonei;

int main(){
  LOG_INIT("./xiaonei_test.log", "DEBUG");
  string session_key = "2.7011aec0437f8523af16f3771db74ac2.3600.1288501200-249539684";
  XiaoneiAdapter adapter("2b33c630b1aa4bfc8068c54b3d0ce44e", "7f5416cb3b03476e8c47b4911c98b763");
  vector<UserProfile> friends = adapter.GetFriends(session_key);
  for(size_t i = 0; i < friends.size(); ++i) {
    cout << friends[i].name << "\t:"
         << friends[i].head_url
         << endl;
  }

  friends = XiaoneiAdapter::demo_app().GetFriends(session_key);
  cout << "total friends : " << friends.size() << endl;

  vector<string> friend_ids = XiaoneiAdapter::demo_app().GetAppFriends(session_key);
  cout << "total app friends : " << friend_ids.size() << endl;

  vector<string> uids;
  uids.push_back("334079022");
  uids.push_back("240599893");
  uids.push_back("249539684");
  vector<UserProfile> users = XiaoneiAdapter::demo_app().GetUserInfo(session_key, uids);
  for(size_t i = 0; i < users.size(); ++i) {
    cout << users[i].name << "\t:"
         << users[i].head_url
         << endl;
  }
  // 开心农场
  session_key = "2.6757478e24b1bcaae4eb34bf89537f63.3600.1288501200-249539684";

  friends = XiaoneiAdapter::happy_farm().GetFriends(session_key);
  cout << "farm : total friends : " << friends.size() << endl;

  friend_ids = XiaoneiAdapter::happy_farm().GetAppFriends(session_key);
  cout << "farm : total app friends : " << friend_ids.size() << endl;
  return 0;
}

